<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<script language="javascript">
function divmove(id){
  alert(document.getElementById(id).scroll);
  document.getElementById("college_list").scrollTop=scrollTo.document.getElementById(id);
 
}
</script>

<%#if( params[:id] == 55)%>
<div class="total_left" >
   


 
 <% form_remote_tag(:loading => "Element.show('activity');",:complete => "Element.hide('activity');" ,
   :update => "l1" , :url => {:controller => "main", :action => "view_university"} ) do -%>
     <div class="upper_left">
       <div class="sort_by">
	      <div class="sort">Sort by	</div>

    <div class="city"><input type="radio" name="check" <% if @val=="cities" %>   checked=true <%end%> value="cities" onclick="this.form.onsubmit();" >Cities</div>
  <div class="alphabets"><input type="radio" name="check" <% if @val=="alpha" %>   checked=true<%end%> value="alpha" onclick="this.form.onsubmit();">Alphabetical</div>
  </div>
     </div>

 <%end%>
 <%= image_tag 'spinner.gif', :id => 'activity', :style => 'display:none' %>


<div class="lower_left">

 
  




  <div class="alphabet_links">
      <ul>
      <%i=65%>
      <% 26.times do %>
      <!--<div><a href="javascript:divmove('<#%=i.chr%>')" > <#%= i.chr %></a> </div>-->
      <div><a href="javascript:divmove(<%=i.chr%>)" > <%= i.chr %></a></div>

        <%i=i+1%>
      <%end%>
      </ul>
  </div>
  <div class="select_text">Select your Campus from the List</div>
</div>
  <div id="college_list" class="college_list">
    
    
     
     <% if @val=="cities" %>
        <%City.find(:all, :include => :universities ,:order => "name").each do |city| -%>
           <div class="city-window" id="<%=city.name[0..0]-%>"><%= h(city.name) -%></div>
             <%if city.universities.empty? -%>
                     No university available.
            <%else -%>
            <div class="institute-window">
             <%city.universities.each do |university| -%>
             <div><%= link_to h(university.name), { :controller=> "campus" , :action=>"index" , :id =>university.stripped_name} -%></div>
            <%end-%>
            </div>
         <%end-%>
        <%end%>
     <%else%>
      <%
        alpha_univerity = Hash.new
       @universities.each do |university|
        alpha_univerity[university.name[0..0].upcase] = Array.new if alpha_univerity[university.name[0..0].upcase].nil?
        alpha_univerity[university.name[0..0].upcase] << university
        end
      %>
  <%"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").each do |alpha_letter| -%>
    <div class="city-window" id="<%=alpha_letter.upcase-%>"> <%=alpha_letter-%> </div>
    <%if alpha_univerity[alpha_letter].nil? %>
      No university available.
    <%else%>
    <div class="institute-window">
      <%alpha_univerity[alpha_letter].each do |university| -%>
       <!--<div> <#%= h("#{university.name}, #{university.city.name}") -%><br/> </div>-->
        <div><%= link_to h("#{university.name}, #{university.city.name}"), { :controller=> "campus" , :action=>"index" , :id =>university.stripped_name} -%></div>
      <%end%>
     </div>
    <%end%>
    <hr/>
<%end%>
<%end%>
</div>
</div>

        